package org.mfw.obj.mob
{
	import flash.display.Bitmap;
	import flash.display.Loader;
	import flash.net.URLRequest;
	
	import org.mfw.interfaces.obj.list.IAlbumList;
	import org.mfw.interfaces.obj.mob.ICover;

	public class Cover extends MediaObject implements ICover
	{
		protected var _coverURL:String;
		protected var _coverLoader:Loader= new Loader();
				
		public function Cover(ID:Number,CoverURL:String=null)
		{
			this._ID=ID;
			if(CoverURL){
				this._coverURL=CoverURL;
				this._coverLoader.load(new URLRequest(this._coverURL));
			}
		}
		
		
		public function get pictureURL():String
		{
			return this._coverURL;
		}
		
		public function get loader():Loader
		{
			return this._coverLoader;
		}
		
		public function get picture():Bitmap 
		{
			return this._coverLoader.content as Bitmap;
		}
		
		public function get albumList():IAlbumList
		{
			return null;
		}
		
		public function get bitmapIsLoaded():Boolean 
		{
			if((this._coverLoader.contentLoaderInfo.bytesTotal!=0)&& (this._coverLoader.contentLoaderInfo.bytesTotal == this._coverLoader.contentLoaderInfo.bytesLoaded)){
				return true;
			} else return false;
		}
		
	}
}